package com.ruoyi.procured.mapper;

import com.ruoyi.common.core.domain.OrdersProduct;
import com.ruoyi.procured.domain.ProcuredOrdersProduct;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* @author Admin
* @description 针对表【tb_orders_product】的数据库操作Mapper
* @createDate 2024-10-01 16:35:55
* @Entity com.ruoyi.procured.domain.ProcuredOrdersProduct
*/
@Mapper
public interface ProcuredOrdersProductMapper extends BaseMapper<ProcuredOrdersProduct> {

	/**
	 * 根据采购订单号查询对应的采购订单商品信息
	 * @param ordersId
	 * @return
	 */
	List<OrdersProduct> selectByOrdersId(@Param("ordersId") List<Long> ordersId,@Param("planId") Long planId);

	/**
	 *  根据订单id和产品id查询明细
	 * @param ordersIds
	 * @param productId
	 * @return
	 */
	List<OrdersProduct> selectOrdersProduct(@Param("ordersIds") List<Long> ordersIds,@Param("productId") Long productId);

	/**
	 * 更新采购商品明细待退货数量
	 * @param id
	 * @param assignQuantity
	 * @return
	 */
	int updateReturnPendingQuantity(@Param("id") Long id,@Param("assignQuantity") long assignQuantity);



	/**
	 * 根据所有的采购计划id和产品id查询对应的采购单
	 * @param collect
	 * @return
	 */
	List<String> selectByPlanId(@Param("list") List<Long> collect,@Param("productId") Long productId);

	/**
	 * 更新是否全部退款或者退货完的状态
	 * @param id
	 * @return
	 */
	int updateReturnCompletedStatus(@Param("id") Long id);

	/**
	 * 修改对应的操作日志
	 * @param operationLog
	 * @param productId
	 * @param procuredOderId
	 * @return
	 */
	int updateLog(@Param("operationLog") String operationLog,
				  @Param("productId") String productId,
				  @Param("procuredOderId") String procuredOderId);
}




